import { defHttp } from '/@/common/util/axios';

enum Api {
  list = '/wxPay/wxOrder/getPage',
  save = '/wxPay/wxOrder/add',
  edit = '/wxPay/wxOrder/edit',
  deleteOne = '/wxPay/wxOrder/delete',
  updateBatch = '/wxPay/wxOrder/updateBatch',
  deleteBatch = '/wxPay/wxOrder/deleteBatch',
  importExcel = '/wxPay/wxOrder/importExcel',
  exportXls = '/wxPay/wxOrder/exportXls',

  nativeApi = '/wxPay/native',    //统一下单
  getOrder = '/wxPay/getOrder',  //微信查单
  getRefundOrder = '/wxPay/getRefundOrder',  //微信查单-退款
  confirmOrder = '/wxPay/confirmOrder',      //确定订单
  refundsOrder = '/wxPay/refundsOrder',      //订单退款
  downloadBill = '/wxPay/downloadBill',      //订单退款
}
/**
 * 导出导入api
 * @param params
 */
export const getExportUrl = Api.exportXls;
export const getImportUrl = Api.importExcel;
/**
 * 增删改查接口
 */
export const list = (params) => defHttp.get({ url: Api.list, params });
export const saveOrUpdate = (params, isUpdate) => defHttp.post({ url: isUpdate ? Api.edit : Api.save, params });
export const deleteOne = (params) => defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true });
export const updateBatch = (params) => defHttp.post({ url: Api.updateBatch, params });
export const deleteBatch = (params) => defHttp.delete({ url: Api.deleteBatch, params }, { joinParamsToUrl: true });

export const nativePay = (params) => defHttp.post({ url: Api.nativeApi, params });
export const getOrder = (params) => defHttp.get({ url: Api.getOrder + '/' + params });
export const getRefundOrder = (params) => defHttp.get({ url: Api.getRefundOrder + '/' + params });
export const confirmOrder = (params) => defHttp.post({ url: Api.confirmOrder + '/' + params });
export const refundsOrder = (params) => defHttp.post({ url: Api.refundsOrder, params });
export const downloadBill = (p1, p2) => defHttp.get({ url: Api.downloadBill + '/' + p1 + '/' + p2 });
